<?php 
if($_SERVER['REQUEST_METHOD'] == 'POST'){ 
	if(isset($_FILES['photo']) && is_uploaded_file($_FILES['photo']['tmp_name'])){ 
		$rand_id = date("Ymdhis").mt_rand(1000,9999); 
		$ext_name = pathinfo($_FILES['photo']['name'],PATHINFO_EXTENSION); 
		$file_name = $rand_id.'.'.$ext_name; 
		move_uploaded_file($_FILES['photo']['tmp_name'],'up/'.$file_name); 
		$path = 'up/'.$file_name; 
	} 
} 
?> 
<script languge="javascript">
	var xmlHttp;
	xmlHttp = create_obj();
	function create_obj(){
		var xmlHttp;
		xmlHttp = new XMLHttpRequest();
		return xmlHttp;
	}

	function process(){
		name = document.getElementById("usernum").value;
		xmlHttp.open("GET","../control/AutoFillBlank.php?name="+name,true);
		xmlHttp.onreadystatechange = handle_f;
		xmlHttp.send(null);	
	}

	function handle_f(){
		if(xmlHttp.readyState == 4){
			if(xmlHttp.status==200){
				result = xmlHttp.responseText;
			
				if(result != null){
					var element = result.split("----");
					document.getElementById( 'userage' ).value = element[3];
					document.getElementById( 'usernation' ).value = element[2];
					document.getElementById( 'username' ).value = element[0];
					document.getElementById( 'college' ).value = element[5];
					document.getElementById( 'usermajor' ).value = element[6];
					document.getElementById( 'userphone' ).value = element[4];
					document.getElementById( 'userface' ).value = element[7];
					document.getElementById(element[1] ).checked = "checked";

				}
	//			document.getElementById( 'message' ).innerHTML = result;

			}else{
				alert("出错了!!!!"+xmlHttp.statusText);
			}
		}
	}

</script>
<!doctype html>
<html>
   <head>
    <title>云南大学图书管</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8" />
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/headernav.css">
	<script type="text/javascript" src="js/jquery.js" ></script>
    <script type="text/javascript" src="js/bootstrap.min.js" ></script>
	 
   </head>

   <body>
   <form enctype="multipart/form-data" action="../control/receiveRegister.php" method="post" name="uploadForm" id="uploadForm">
  <div id="logo">
  <img src="../images/icon.png">
  <span>图书馆勤工办公系统</span>
</div>
  <!--导航-->
  <nav class="navbar navbar-default" role="navigation" id="header_nav">

  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
     
    </div>
 

<div id="mainbody0"  >
<div class="col-lg-12" id="charge">
    <div class="panel panel-primary">
   <div class="panel-heading">
      <h3 class="panel-title">入职申请</h3>
   </div>
   <div class="panel-body">
     
   </div>
<table width="982" border="0" align="center">
  <tr>
    <td height="593">
	<table width="981" height="593" border="0" cellspacing="0" bordercolor="#999999">
      <tr>
        <td width="360" align="center">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:<input type="text" name="usernum" id="usernum" onchange = "process()"/>
        </td>
        <td width="400">性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="radio" name="sex" id="男"  value="男" checked/>男&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="radio" name="sex" id="女" value="女"/>女</td>
        <td width="220" rowspan="7">
		<table width="100%" height="180" border="0" cellpadding="1" cellspacing="0" bordercolor="#999999">
          <tr>
            <td width="100%" height="15%">
			选择照片(jpg/png/bmp/gif)
			<input name="photo" type="file" onChange="form.submit()" size="20"/>
			</td>
          </tr>
          <tr>
            <td height="85%">
			<img src="<?=$path?>" style="width:135px;height:180px;"/>
			</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="center">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:<input type="text" name="username" id="username"/></td>
        <td>学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;院:
		<select name="college" id="college">
		<option value="人文学院">人文学院</option>
		<option value="法学院">法学院</option>
		<option value="艺术与设计学院">艺术与设计学院</option>
		<option value="化学科学与工程学院">化学科学与工程学院</option>
		<option value="软件学院">软件学院</option>
		<option value="留学生学院">留学生学院</option>
		<option value="医学院">医学院</option>
		<option value="经济学院">经济学院</option>
		<option value="外国语学院">外国语学院</option>
		<option value="数学与统计学院">数学与统计学院</option>
		<option value="生命科学学院">生命科学学院</option>
		<option value="资源环境与地球科学学院">资源环境与地球科学学院</option>
		<option value="职业与继续教育学院">职业与继续教育学院</option>
		<option value="农学院">农学院</option>
		<option value="马克思主义学院">马克思主义学院</option>
		<option value="公共管理学院">公共管理学院</option>
		<option value="工商管理与旅游管理学院">工商管理与旅游管理学院</option>
		<option value="信息学院">信息学院</option>
		<option value="城市建设与管理学院">城市建设与管理学院</option>
		<option value="体育学院">体育学院</option>
		<option value="国际学院">国际学院</option>
		<option value="生态学与环境学院">生态学与环境学院</option>
		<option value="大学外语教学部">大学外语教学部</option>
		<option value="研究生学院">研究生学院</option>
		</select></td>
        </tr>
      <tr>
        <td align="center">民&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;族:<input type="text" name="usernation" id="usernation"/></td>
        <td>专&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;业:<input type="text" name="usermajor" id="usermajor"/></td>
        </tr>
      <tr>
        <td align="center">年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;龄:<input type="text" name="userage" id="userage"/></td>
        <td>电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话:<input type="text" name="userphone" id="userphone"/></td>
        </tr>
      <tr>
        <td align="center">政治面貌:<input type="text" name="userface" id="userface"/></td>
        <td>申请岗位:<input type="text" name="station" id="station"/><a href="workintroduction.html" style="top:200px; position:absolute; left=500px; " >岗位介绍</a></td>
		
        <td align="center"></td>
        </tr>
      <tr>
       <td></td>
        <td></td>
        </tr>
      <tr>
        
		</td>
        </tr>
      <tr>
        <td colspan="3">
		<table width="980" height="107" border="0" cellspacing="0">
          <tr>
            <td width="100" height="106" ><p align="center"><font size="4"><b>申</br>请</br>理</br>由</b></font></p></td>
            <td ><textarea name="reason" id ="reason"cols="115" rows="5"></textarea></td>
          </tr>
        </table></td>
        </tr>
      
      <tr align="center">
        <td colspan="3"><table width="980" height="60" border="1" cellspacing="0" bordercolor="#1874CD">
          <tr>
            <td width="222"><p><center>空闲时间:</center></p>
              <p>（你希望在哪些时段参加勤工）</p></td>
            <td width="758" ><table width="873" height="156" border="0">
              <tr>
                <td><div align="center">星期一</div></td>
                <td><div align="center">星期二</div></td>
                <td><div align="center">星期三</div></td>
                <td><div align="center">星期四</div></td>
                <td><div align="center">星期五</div></td>
                <td><div align="center">星期六</div></td>
                <td><div align="center">星期日</div></td>
              </tr>
              <tr>
                <td><input type="checkbox" name="time[]" value="星期一;12:30-16:00,"/>12:30—16:00&nbsp;</td>
                <td><input type="checkbox" name="time[]" value="星期二;12:30-16:00,"/>12:30—16:00&nbsp;</td>
                <td><input type="checkbox" name="time[]" value="星期三;12:30-16:00,"/>12:30—16:00&nbsp;</td>
                <td><input type="checkbox" name="time[]" value="星期四;12:30-16:00,"/>12:30—16:00&nbsp;</td>
                <td><input type="checkbox" name="time[]" value=""/> ----------------&nbsp;</td>
                <td><input type="checkbox" name="time[]" value="星期六;8:30-12:30,"/>8:30—12:30&nbsp;</td>
                <td><input type="checkbox" name="time[]" value="星期日;8:30-12:30,"/>8:30—12:30&nbsp;</td>
              </tr>
              <tr>
                <td><input type="checkbox" name="time[]" value="星期一;16:00-18:00,"/>16:00—18:00</td>
                <td><input type="checkbox" name="time[]" value="星期二;16:00-18:00,"/>16:00—18:00</td>
                <td><input type="checkbox" name="time[]" value="星期三;16:00-18:00,"/>16:00—18:00</td>
                <td><input type="checkbox" name="time[]" value="星期四;16:00-18:00,"/>16:00—18:00</td>
                <td><input type="checkbox" name="time[]" value=""/>-----------------</td>
                <td><input type="checkbox" name="time[]" value="星期六;12:30-17:30,"/>12:30—17:30</td>
                <td><input type="checkbox" name="time[]" value="星期日;12:30-17:30,"/>12:30—17:30</td>
              </tr>
              <tr>
                <td><input type="checkbox" name="time[]" value="星期一;18:00-22:30,"/>18:00—22:30</td>
                <td><input type="checkbox" name="time[]" value="星期二;18:00-22:30,"/>18:00—22:30</td>
                <td><input type="checkbox" name="time[]" value="星期三;18:00-22:30,"/>18:00—22:30</td>
                <td><input type="checkbox" name="time[]" value="星期四;18:00-22:30,"/>18:00—22:30</td>
                <td><input type="checkbox" name="time[]" value=""/>-----------------</td>
                <td><input type="checkbox" name="time[]" value="星期六;17:30-22:30,"/>17:30—22:30</td>       
				<td><input type="checkbox" name="time[]" value="星期日;17:30-22:30,"/>17:30—22:30</td>       
              </tr>
            </table></td>
          </tr>
        </table>
		</td>
        </tr>
      <tr>
        <td height="37" colspan="3" align="center">
		<input type="image" src="../images/submit.jpg" />
		</td>
      </tr>
    </table></td>
  </tr>
</table>

</div>

</div>

</div> 
<footer>
	<div>
		 <div class="panel panel-default" id="foot" >
			 <div class="panel-body" align="center">
			版权信息 © 2014, 云南大学图书馆         
			 </div>
		 </div>
	</div>
</footer>
</form>
</body>
</html>